home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LT_Activate.c < prev    next >
C/C++ Source or Header  |  1996-08-22  |  2KB  |  77 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. /****** gtlayout.library/LT_Activate ******************************************
  15. *
  16. *   NAME
  17. *    LT_Activate -- Activate a string type gadget.
  18. *
  19. *   SYNOPSIS
  20. *    LT_Activate(Handle,ID);
  21. *                  A0   D0
  22. *
  23. *    VOID LT_Activate(LayoutHandle *,LONG);
  24. *
  25. *   FUNCTION
  26. *    The equivalent to intuition.library/ActivateGadget().
  27. *
  28. *   INPUTS
  29. *    Handle - Pointer to LayoutHandle structure.
  30. *
  31. *    ID - ID of Gadget to activate.
  32. *
  33. *   RESULT
  34. *    none
  35. *
  36. *   SEE ALSO
  37. *    intuition.library/ActivateGadget
  38. *
  39. ******************************************************************************
  40. *
  41. */
  42.  
  43. VOID LIBENT
  44. LT_Activate(REG(a0) LayoutHandle *handle,REG(d0) LONG id)
  45. {
  46.     struct Gadget *gadget;
  47.  
  48.     if(gadget = LTP_FindGadget(handle,id))
  49.     {
  50.         ObjectNode *node;
  51.  
  52.         if(GETOBJECT(gadget,node))
  53.         {
  54.             if(!node->Disabled)
  55.             {
  56. #ifdef DO_BOOPSI_KIND
  57.                 if(LIKE_STRING_KIND(node) || (node->Type == INTEGER_KIND) || (node->Type == BOOPSI_KIND && node->Special.BOOPSI.ActivateHook))
  58. #else
  59.                 if(LIKE_STRING_KIND(node) || (node->Type == INTEGER_KIND))
  60. #endif
  61.                 {
  62.                     handle->Previous = gadget;
  63. #ifdef DO_BOOPSI_KIND
  64.                     if(node->Type == BOOPSI_KIND)
  65.                     {
  66.                         if(node->Special.BOOPSI.ActivateHook)
  67.                             CallHookPkt(node->Special.BOOPSI.ActivateHook,(APTR)handle,node->Host);
  68.                     }
  69.                     else
  70. #endif
  71.                         ActivateGadget(handle->Previous,handle->Window,NULL);
  72.                 }
  73.             }
  74.         }
  75.     }
  76. }
  77.